<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<view class="uni-flex uni-column">
			<view class="item" v-for="(value, index) in iconType" :key="index">
				<icon :type="value" size="26" />
				<text>{{value}}</text>
			</view>

			<view class="uni-form-item uni-column">
				<view class="title">输入值：{{inputValue}}</view>
				<input class="uni-input" @input="onKeyInput" placeholder="自动获得焦点" />
			</view>

			<button type="primary" @click="goto('/pages/about/about')">test</button>
			<button type="primary" @click="test2()">test2</button>
		</view>
	</view>
</template>

<script>
	import {
		http
	} from '@/utils/http';

	export default {
		data() {
			return {
				type: 'C',
				title: 'Hello-test-123',
				inputValue: 'xx',
				iconType: ['success', 'info', 'warn', ]
			}
		},
		methods: {
			onKeyInput: function(event) {
				// console.info(event.detail.value)
				this.inputValue = event.detail.value
			},
			goto(url) {
				this.iconType = ['success', 'warn', ]
				console.info(this.$data)
			},
			test2() {
				this.testDb();
			},

			testDb() {
				const db = uniCloud.database();
				db.collection('test_01')
					.get()
					.then(res => {
						console.info('res:', res)
					});
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>